<template>
  <panel style="padding: 0" :hideTitle="true">
    <div class="search-box">
      <el-row class="form-horizontal">
        <el-col :span="8" class="right mr15">
          <el-input
            size="small"
            placeholder="请输入内容"
            icon="search"
            v-model="input"
            :on-icon-click="handleIconClick">
          </el-input>
        </el-col>
      </el-row>
    </div>


  <el-table
    :data="projectTable"
    stripe
    border
    tooltip-effect="dark"
    :row-key="getRowKeys"
    :expand-row-keys="expands"
    @expand="expand"
    style="width: 100%">
    <el-table-column type="expand">



      <el-table :data="projectTable" stripe border style="width: 100%" height=200px>
        <el-table-column
          label="项目/分期名称"
          prop="name"
          :resizable="false">
        </el-table-column>

        <el-table-column
          label="编码"
          prop="code"
          :resizable="false">
          <template scope="scope">
            <div v-if="true">
              <router-link :to="'./pdetail/'+scope.row.id">{{scope.row.code}}</router-link>
            </div>
          </template>
        </el-table-column>

        <el-table-column
          label="项目/分期备案名"
          prop="caseName"
          :resizable="false">
        </el-table-column>

        <el-table-column
          label="税收征收方式"
          prop=""
          :resizable="false">
        </el-table-column>

        <el-table-column
          label="开发状态"
          prop=""
          :resizable="false">
        </el-table-column>

        <el-table-column
          label="审批状态"
          prop=""
          :resizable="false">
        </el-table-column>

      </el-table>





    </el-table-column>


    <el-table-column
      label="项目/分期名称"
      prop="name"
      :resizable="false">
    </el-table-column>

    <el-table-column
      label="编码"
      prop="code"
      :resizable="false">
      <template scope="scope">
        <div v-if="true">
          <router-link :to="'./pdetail/'+scope.row.id">{{scope.row.code}}</router-link>
        </div>
      </template>
    </el-table-column>

    <el-table-column
      label="项目/分期备案名"
      prop="caseName"
      :resizable="false">
    </el-table-column>

    <el-table-column
      label="税收征收方式"
      prop=""
      :resizable="false">
    </el-table-column>

    <el-table-column
      label="开发状态"
      prop=""
      :resizable="false">
    </el-table-column>

    <el-table-column
      label="审批状态"
      prop=""
      :resizable="false">
    </el-table-column>

  </el-table>
  </panel>
</template>

<script>

  import {queryProjectHead} from "@/api/house";


  export default {
    data() {
      return {
        tableData5: [{
          id: '12987122',
          name: '好滋好味鸡蛋仔',
          category: '江浙小吃、小吃零食',
          desc: '荷兰优质淡奶，奶香浓而不腻',
          address: '上海市普陀区真北路',
          shop: '王小虎夫妻店',
          shopId: '10333'
        }, {
          id: '12987123',
          name: '好滋好味鸡蛋仔',
          category: '江浙小吃、小吃零食',
          desc: '荷兰优质淡奶，奶香浓而不腻',
          address: '上海市普陀区真北路',
          shop: '王小虎夫妻店',
          shopId: '10333'
        }, {
          id: '12987125',
          name: '好滋好味鸡蛋仔',
          category: '江浙小吃、小吃零食',
          desc: '荷兰优质淡奶，奶香浓而不腻',
          address: '上海市普陀区真北路',
          shop: '王小虎夫妻店',
          shopId: '10333'
        }, {
          id: '12987126',
          name: '好滋好味鸡蛋仔',
          category: '江浙小吃、小吃零食',
          desc: '荷兰优质淡奶，奶香浓而不腻',
          address: '上海市普陀区真北路',
          shop: '王小虎夫妻店',
          shopId: '10333'
        }],

        projectTable: [],


        getRowKeys(row){
          return row.id;
        },

        expands:[],



        /**
         * 重点搜索
         */
        input: '',
      }
    },

    mounted() {
      //初始化表的头部项目信息
      this.initTableHead();
     // this.expands.push(this.tableData5[1].id);

    },


    methods: {

      /**
       * 重点搜索
       */
      handleIconClick(ev) {
        alert(ev)
      },


      expand(row){
        alert(JSON.stringify(row))
      },


      /**
       * 初始化项目头部
       */
      initTableHead(){
        const _this = this;
        queryProjectHead().then(res=>{
          if(res.list!=undefined){
            for(let i=0; i<res.list.length; i++){
              if(res.list[i].projectHead!=undefined){
                let temp = {
                  "id":res.list[i].projectHead.id,
                  "name":res.list[i].projectHead.name,
                  "code":res.list[i].projectHead.code,
                  "caseName":res.list[i].projectHead.caseName,
                }
                _this.projectTable.push(temp);
              }
            }
          }

        })
      }



    }
  };
</script>

<style>

</style>
